package prh25.biblioteca.entity.dao.hibernate;

import java.util.List;

import org.hibernate.criterion.Restrictions;

import prh25.biblioteca.entity.ProjetoPesquisa;
import prh25.biblioteca.entity.dao.ProjetoPesquisaDAO;

/**
 * <p>Hibernate DAO layer for ProjetoPesquisas</p>
 * <p></p>
 *
 * @author Wilson
 * @see http://code.google.com/p/prh-doc/
 */
public class ProjetoPesquisaHibernateDAO extends
		AbstractHibernateDAO<ProjetoPesquisa, Integer> implements
		ProjetoPesquisaDAO {

	/**
	 * Find ProjetoPesquisa by version
	 */
	public List<ProjetoPesquisa> findByVersion(Integer version) {
		return findByCriteria(Restrictions.eq("version", version));
	}
	
	/**
	 * Find ProjetoPesquisa by entityUid
	 */
	public List<ProjetoPesquisa> findByEntityUid(String entityUid) {
		return findByCriteria(Restrictions.eq("uid", entityUid));
	}
	
	/**
	 * Find ProjetoPesquisa by nome
	 */
	public List<ProjetoPesquisa> findByNome(String nome) {
		return findByCriteria(Restrictions.eq("nome", nome));
	}
	
	/**
	 * Find ProjetoPesquisa by curso
	 */
	public List<ProjetoPesquisa> findByCurso(String curso) {
		return findByCriteria(Restrictions.eq("curso", curso));
	}
	
	/**
	 * Find ProjetoPesquisa by duracao
	 */
	public List<ProjetoPesquisa> findByDuracao(String duracao) {
		return findByCriteria(Restrictions.eq("duracao", duracao));
	}
	
	/**
	 * Find ProjetoPesquisa by status
	 */
	public List<ProjetoPesquisa> findByStatus(String status) {
		return findByCriteria(Restrictions.eq("status", status));
	}
	
	/**
	 * Find ProjetoPesquisa by descricao
	 */
	public List<ProjetoPesquisa> findByDescricao(String descricao) {
		return findByCriteria(Restrictions.eq("descricao", descricao));
	}
	
	/**
	 * Find ProjetoPesquisa by professorId
	 */
	@SuppressWarnings("unchecked")
	public List<ProjetoPesquisa> findByProfessorId(Integer professorId) {
		return findByCriteria(Restrictions.eq("professor.id", professorId));
	}
	

}
